package com.lagou.miaosha.rocketmq.mapper;

import com.lagou.miaosha.rocketmq.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Description TODO
 * @Classname OrderMapper
 * @Date 2021/7/21 20:21
 * @Author ch'ien
 */

@Mapper
public interface OrderMapper {

    @Select("select * from `order` where status = 2")
    List<Order> getListForCancel();

    @Select("select * from `order` where orderNo = #{orderNo}")
    Order getOneByOrderNo(String orderNo);

    @Insert("insert into `order` ( gid, userId, orderNo , status) values (#{gid}, #{userId},#{orderNo}, #{status})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    int save(Order order);


    @Update("update `order` set status = #{status} where orderNo = #{orderNo}")
    int update(Order order);
}
